<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>练习题</title>
</head>

<body>
    <pre>
        5、写一个11位手机号的验证，以1开头，第二个字符必须是3,4,5,7,8
    </pre>
    <script>
        var str = /^1[3-57-8]\d{9}$/g
    </script>

    <pre>
        6、国内的电话号码"0511-4405222"或者是"020-88885555"
    </pre>
    <script>
        var str2 = /^0\d{2,3}-+\d{7,8}$/g
        var b = "020-88885555"
        var a = '0511-4405222';
        var c = str2.test(b)
        console.log("b:" + c);
    </script>

    <pre>
        7、至少8位，可以是数字或者字母的密码，不能是其他的字符
    </pre>
    <script>
        var str3 = /[0-9a-zA-Z]{8,}/g
    </script>

</body>

</html>